package com.github.thinwonton.springboot.showcase.jta.mybatisplus.orders.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.account.dao.AccountMapper;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.account.domain.Account;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.orders.constant.OrderConstants;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.orders.dao.OrdersMapper;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.orders.domain.Orders;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.orders.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * OrdersServiceImpl
 *
 * @author hugo
 * @date 2018/8/24
 */
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {

    @Autowired
    private OrdersMapper ordersMapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void createOrder() {
        Orders record = new Orders();
        record.setStatus(OrderConstants.ORDER_STATUS_PAID);
        ordersMapper.insert(record);
    }
}
